$(function () {
    $("ul li").each(function (ind,d) {
        $(this).bind("click", function () {
            var $img = '<img src="img/kftel.png" height="90%" width="99%" />';
            var id = $(this).attr("class");
            var url = "";
            if (id == "bind") {
                url = "bind";
            } else if (id == "query") {
                url = "toCheckExp";
            } else if (id == "send") {
                url = "sendIndex";
            }
            if (url != "") {
                isBind(url);
            } else {
                //页面层
                layer.open({
                    type: 1,
                    area: ["70%", "40%"]
                    , content: $img
                    , style: 'width: 70%; height: 50%; overflow: hidden;'
                });
            }
        });
    });
    // 判断是否绑定手机
    function isBind(url) {
        var phone = $("#phone").val();
        if(url!="bind" &&　(phone=="" || phone==undefined)){
            //信息框
            layer.open({
                content: '还未绑定手机,请先绑定手机号'
                ,btn: '确定'
            });
        } else {
            // 判断是否绑定,如绑定弹出提示
            if(url=="bind" && phone!=""){
                //信息框
                layer.open({
                    content: '你已经绑定手机,如需要更换请点击更改手机'
                    ,btn: ['更改手机','确定'],
                    yes: function(index){
                        layer.close(index);
                        if(url!=undefined){
                            window.location.href = url;
                        }
                    }
                });
            } else {
                window.location.href = url;
            }
        }
    }
});
